// 项目设置
import variables from '@/assets/styles/element-variables.scss'
import defaultSettings from '@/settings'

const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings

// 本地存储取主题设置
const storageSetting = localStorage.getItem('layout-setting') || ''
const state = {
    theme:storageSetting.theme || variables.theme,
    sideTheme:storageSetting.sideTheme || sideTheme,
    showSettings: showSettings,
}
const mutations = {
    CHANGE_SETTING: (state, { key, value }) => {
        if (state.hasOwnProperty(key)) {
          state[key] = value
        }
      }
}
const actions = {
     // 修改布局设置
  changeSetting({ commit }, data) {
    commit('CHANGE_SETTING', data)
  },
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}
